package com.kocel.block.model;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "tb_blockRecord", schema = "dbo", catalog = "Block")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class TbBlockRecord {
    private String objId;
    private String userId;
    private String outStorageTime;
    private Double outNum;
    private String reason;
    private String state;
    private String receiveTime;
    private String machiningReceiveTime;
    private String checkConfirmTime;
    private String outSourcingTime;
    private String outSouringReceiveTime;

    private TbBlockInventory tbBlockInventory;
    //private String blockId;

    @Id
    @Column(name = "objId")
    @GeneratedValue(generator = "jpa-uuid")
    public String getObjId() {
        return objId;
    }

    public void setObjId(String objId) {
        this.objId = objId;
    }

//    @Basic
//    @Column(name = "blockId")
//    public String getBlockId() {
//        return blockId;
//    }
//
//    public void setBlockId(String blockId) {
//        this.blockId = blockId;
//    }

    @ManyToOne(cascade = {CascadeType.ALL})
    @JoinColumn(name = "blockId")
    public TbBlockInventory getTbBlockInventory(){return tbBlockInventory; }

    public void setTbBlockInventory(TbBlockInventory tbBlockInventory){this.tbBlockInventory = tbBlockInventory; }

    @Basic
    @Column(name = "userId")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "outStorageTime")
    public String getOutStorageTime() {
        return outStorageTime;
    }

    public void setOutStorageTime(String outStorageTime) {
        this.outStorageTime = outStorageTime;
    }

    @Basic
    @Column(name = "outNum")
    public Double getOutNum() {
        return outNum;
    }

    public void setOutNum(Double outNum) {
        this.outNum = outNum;
    }

    @Basic
    @Column(name = "reason")
    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Basic
    @Column(name = "state")
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    @Basic
    @Column(name = "receiveTime")
    public String getReceiveTime() {
        return receiveTime;
    }

    public void setReceiveTime(String receiveTime) {
        this.receiveTime = receiveTime;
    }

    @Basic
    @Column(name = "machiningReceiveTime")
    public String getMachiningReceiveTime() {
        return machiningReceiveTime;
    }

    public void setMachiningReceiveTime(String machiningReceiveTime) {
        this.machiningReceiveTime = machiningReceiveTime;
    }

    @Basic
    @Column(name = "checkConfirmTime")
    public String getCheckConfirmTime() {
        return checkConfirmTime;
    }

    public void setCheckConfirmTime(String checkConfirmTime) {
        this.checkConfirmTime = checkConfirmTime;
    }

    @Basic
    @Column(name = "outSourcingTime")
    public String getOutSourcingTime() {
        return outSourcingTime;
    }

    public void setOutSourcingTime(String outSourcingTime) {
        this.outSourcingTime = outSourcingTime;
    }

    @Basic
    @Column(name = "outSouringReceiveTime")
    public String getOutSouringReceiveTime() {
        return outSouringReceiveTime;
    }

    public void setOutSouringReceiveTime(String outSouringReceiveTime) {
        this.outSouringReceiveTime = outSouringReceiveTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbBlockRecord that = (TbBlockRecord) o;
        return Objects.equals(objId, that.objId) &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(outStorageTime, that.outStorageTime) &&
                Objects.equals(outNum, that.outNum) &&
                Objects.equals(reason, that.reason) &&
                Objects.equals(state, that.state) &&
                Objects.equals(receiveTime, that.receiveTime) &&
                Objects.equals(machiningReceiveTime, that.machiningReceiveTime) &&
                Objects.equals(checkConfirmTime, that.checkConfirmTime) &&
                Objects.equals(outSourcingTime, that.outSourcingTime) &&
                Objects.equals(outSouringReceiveTime, that.outSouringReceiveTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(objId, userId, outStorageTime, outNum, reason, state, receiveTime, machiningReceiveTime, checkConfirmTime, outSourcingTime, outSouringReceiveTime);
    }
}
